#ifndef VACATION_H
#define VACATION_H

#include <QWidget>
#include <QTcpSocket>
#include <QDate>

namespace Ui {
class Vacation;
}

class Mainpage;  // 前向声明

class Vacation : public QWidget
{
    Q_OBJECT

public:
    explicit Vacation(const QString &employeeId, Mainpage *mainpage, QWidget *parent = nullptr);
    ~Vacation();

protected:
    // 用于拖动窗口的事件处理函数
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;

    void paintEvent(QPaintEvent *event) override;

private slots:
    void on_returnButton_clicked();

    void on_yes_clicked();

    void readServerResponse();

private:
    Ui::Vacation *ui;
    Mainpage *mainpageWindow;
    QString employeeId;  // 存储工号
    QTcpSocket *tcpSocket;

    void sendEmployeeIdToServer();

    // 用于记录拖动时鼠标位置的成员变量
    QPoint m_dragPosition;

    // 添加用于判断是否点击标题栏的成员变量
    bool m_isTitleBarClicked = false;
};

#endif // VACATION_H
